//
//  UIImageView+LLAsycLoading.m
//  live.ly
//
//  Created by bob on 16/3/14.
//  Copyright © 2016年 musical.ly. All rights reserved.
//

#import <YYWebImage/YYWebImage.h>


@implementation UIImageView (LLAsycLoading)

- (void)ll_loadImageWithImageURL:(NSURL *)imageURLString placeHolderImage:(UIImage *)placeHolderImage
{
#ifdef AS_MUSICALLY_POD
    NSString *urlString = imageURLString.absoluteString;
    if ([urlString containsString:@"default_user_icon"]) {
        imageURLString = [NSURL URLWithString:@""];
    }
#endif

    [self yy_cancelCurrentImageRequest];

    if ([self isKindOfClass:[YYAnimatedImageView class]]) {
        YYAnimatedImageView *s = (id)self;
        s.autoPlayAnimatedImage = YES;
    }
    [self yy_setImageWithURL:imageURLString
        placeholder:placeHolderImage
        options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation
        manager:[YYWebImageManager sharedManager]
        progress:nil
        transform:^UIImage *(UIImage *image, NSURL *url) {
            return image;
        }
        completion:^(UIImage *image, NSURL *url, YYWebImageFromType from, YYWebImageStage stage, NSError *error){
        }];
}


@end
